import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MemberRechargeConfigVO, MemberRechargeConfigForm, MemberRechargeConfigQuery } from '@/api/member/memberRechargeConfig/types';

/**
 * 查询会员充值设置列表
 * @param query
 * @returns {*}
 */

export const listMemberRechargeConfig = (query?: MemberRechargeConfigQuery): AxiosPromise<MemberRechargeConfigVO[]> => {
  return request({
    url: '/member/memberRechargeConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询会员充值设置详细
 * @param rechargeConfigId
 */
export const getMemberRechargeConfig = (rechargeConfigId: string | number): AxiosPromise<MemberRechargeConfigVO> => {
  return request({
    url: '/member/memberRechargeConfig/' + rechargeConfigId,
    method: 'get'
  });
};

/**
 * 新增会员充值设置
 * @param data
 */
export const addMemberRechargeConfig = (data: MemberRechargeConfigForm) => {
  return request({
    url: '/member/memberRechargeConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改会员充值设置
 * @param data
 */
export const updateMemberRechargeConfig = (data: MemberRechargeConfigForm) => {
  return request({
    url: '/member/memberRechargeConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除会员充值设置
 * @param rechargeConfigId
 */
export const delMemberRechargeConfig = (rechargeConfigId: string | number | Array<string | number>) => {
  return request({
    url: '/member/memberRechargeConfig/' + rechargeConfigId,
    method: 'delete'
  });
};
